home *** CD-ROM | disk | FTP | other *** search
- /* Msg7 and Msg7PPC.elf
- *
- * This test program sends 1000 messages to the PPC and
- * shows how long this takes.
- * The Messages are send synchron and every msg must
- * be replied after another.
- * Each Message has a Body with the size of 3747 bytes
- * and the PPC side checks if the msg is received correctly.
- */
-
- #include <exec/types.h>
- #include <exec/nodes.h>
- #include <exec/lists.h>
- #include <exec/memory.h>
- #include <utility/tagitem.h>
- #include <powerup/ppclib/interface.h>
- #include <powerup/ppclib/message.h>
- #include <powerup/ppclib/tasks.h>
- #include <powerup/gcclib/powerup_protos.h>
-
- #define DEBUG 0
-
- #if DEBUG
- #define D(x) x;
- #else
- #define D(x) ;
- #endif
-
- #define TEXT "Text sent by PPC processor\n"
-
- BPTR MyFile;
-
-
- struct StartupData
- {
- ULONG MsgCount;
- };
-
- #define BODYSIZE 3747
-
- int main(void)
- {
- struct StartupData *StartupData;
- void *PPCPort;
- void *ReplyPort;
- void *M68kPort;
- void *PPCMsg;
- void *M68kMsg;
- UBYTE *Body;
- ULONG result;
- ULONG MsgCount;
- ULONG i,j;
-
-
- StartupData =(struct StartupData *) PPCGetTaskAttr(PPCTASKTAG_STARTUP_MSGDATA);
-
- MsgCount = StartupData->MsgCount;
-
- #if DEBUG
- if (MyFile = PPCOpen("con:0/0/640/200/MessageDemo - PPC output/CLOSE", MODE_NEWFILE))
- {
- #endif
- D(PPCfprintf(MyFile,"Creating message port\n"));
-
-
- if (PPCPort =(void*) PPCGetTaskAttr(PPCTASKTAG_MSGPORT))
- {
-
- D(PPCfprintf(MyFile,"Waiting for M68k message\n"));
-
- for (i=0;i<MsgCount;i++)
- {
- PPCWaitPort(PPCPort);
-
- D(PPCfprintf(MyFile,"Getting message\n"));
-
- while (M68kMsg = PPCGetMessage(PPCPort))
- {
- Body =(UBYTE*) PPCGetMessageAttr(M68kMsg, PPCMSGTAG_DATA);
-
- for (j=0;j<BODYSIZE;j++)
- {
- if (Body[j] != ((i+j) & 0xff))
- {
- D(PPCfprintf(MyFile,"MsgBody is wrong\n"));
- }
- }
- PPCReplyMessage(M68kMsg);
- }
- }
-
- }
- else
- {
- D(PPCfprintf(MyFile,"Could not find PPC Task's msgport\n"));
- }
-
- D(PPCfprintf(MyFile,"Closing output\n"));
- #if DEBUG
- PPCClose(MyFile);
- }
- #endif
- }
-
-